2. processing and sorting machine basic fsm approach 1

在本视频中,我们将开始主机项目的实际编程。
In this video, we will start the practical programming on the main machine project.

因此,在上一个视频中,我向您展示了该项目的内容。
So in the last video, I showed you what the project is about.

在本视频中,我们将首先刷新一些有关最佳状态机的概念。
And in this video, we will start by refreshing some concepts about the finest state machines.

我们将尝试开始对这台机器进行编程来编写软件。
And we will try to start programming this machine to write the software.

这个机器,可以说是一种简单的、有限状态机方法。
This machine, lets say in a naive, finite state machine approach.

因此,我们的目的是能够同时处理单个产品并实际写入状态机来执行此操作。
So our purpose here is to be able to process a single product at the time and actually write to the state machine in order to do so.

本视频主要是对结构化文本编程的最终状态机方法进行一些实践。
This video is manned mainly to carry out some practice on this on the final state machine approach of programming in structural text.

因此,让我们首先打开项目中的主程序。
So let's start first by opening the main program that we you have on your project.

我将在此处保持可视化打开状态,以便参考机器的部件,然后让我们开始吧。
I will keep the visualization open over here in order to reference the parts of the machine and let's start.

因此,首先,我们需要有一个状态变量,以便编写状态机结构文本。
So first of all, we will need to have a state variable in order to care to write a state machine structure text.

因此,让我们在这里创建一个状态无符号整数变量。
So let's let's create a state unsigned integer variable over here.

所以我们需要编写一个状态机。
So we will need to write a state machine.

因此,我们需要为州政府提供案例指导。
So we will need to have at case instruction for the state.

正如我们在前面的课程中所看到的,为了执行糖果或蛋糕语句,您需要编写键,即变量的名称。
So as we have seen in the previous course, in order to carry out the sweets or cake statement, you need to write keys, the name of the variable.

这里有开关钥匙,呃,呃,糖果,案例说明。
And here you have your switch keys, uh, uh, sweets, case instruction.

那么让我们从第一个状态开始。
So let's start from first state.

这将是我们的零状态,其中我们拥有机器未运行的机器。
That will be our zero state where we have the machine where the machine is not running.

所以一切仍然是让我们编写一个正在运行的评论机,在这里我们需要实际检测它是否,呃,如果他们开始请求它正在被机器请求。
So everything is still let's write a comment machine running and over here we need to actually detect it if, uh, if they start to request it is being is requested for the machine.

所以在这里我们可以写如果我们按下了开始按钮,那么我们应该跳转到另一个状态进入某些状态。
So over here we can write if we have a start button being pressed, then we should jump to another state into something.

所以让我们写一些像这样简单的东西。
So let's write something as simple as this is.

正在按下启动按钮。
The start button is being pressed.

让我们将其移动到另一个状态,即状态为 10 的状态。
Let's move it to another state that would be state to number 10.

所以我们还提出了一些其他条件。
So but also we that some other conditions.

正如您在这里看到的,我们有许多不同的按钮,所以让我们设置一个互斥条件。
So as you can see over here, we have many different buttons, so let's place a mutual exclusion conditions.

假设我们想要启动机器,如果我们有启动按钮并且没有按下任何其他按钮。
So let's say we want to start the machine if we have the start button and not any of the other buttons being pressed.

所以我们没有紧急按钮。
So we do not have the emergency button.

我们没有,也没有停止按钮。
We didn't and we did not have the stop button.

这些是病毒的名称或您可以在按钮的全局变量列表中找到的变量。
These are the names of the virus or the variables that you you can find over here in the global variable lists of the buttons.

而且我们也没有完整的按钮。
And also we do not have the whole button.

因此,假设如果我们有静态请求,我们应该启动机器。
So let's say that if we have if we have a static request, we should should start the machine.

因此,首先,我们需要确保机器的所有部件都处于正确的位置,这意味着我们需要将活塞放置在其运动范围的开始处。
So first of all, we need to make sure that all the parts of the machine are in the correct position, meaning that we need to have the piston placed at it at the beginning of the of its range of its movement range.

我们需要将控制杆放在左侧。
We need to have the lever placed on the left.

我们需要把电梯放在底部。
We need to have the elevator placed on the bottom.

我们需要将钻头放在顶部。
We need to have the drill placed on the top.

我们需要将桌子定位好,并确定拾取位置。
And we need to have the table positioned, have the pick up position.

因此,我们需要确保一切都处于正确的位置,通常是自动机器。
So we need to make sure that everything is in its, let's say, correct position, typically an automatic machine.

我们为这种程序起了一个名字。
We have a name for this kind of procedure.

这个过程通常称为归位。
And this procedure is typically called homing.

我们需要确保机器是自制的,机器的每个部件在开始时都处于正确的位置。
We need to make sure that the machine is homemade, that every every part of the machine is then in the correct position is positioned at the start.

所以我们需要确保我们知道每个对象的位置,所以让我们首先看看我们能做什么。
So we need to make sure that we know the position of every object, so let's start by seeing what we can do.

我们需要将系统移回来。
We need to move the system back.

所以。
So.

在这里我们可以直接使用机器 home 变量,让我们创建这个变量,假设这是一个卷变量,让我们看看是否拥有机器是否被拥有所需的一切。
Here we can directly use a machine home, the variable, let's create this and let's say that this is a volume variable and let's see if we have everything that we need to see if the machine is owned.

所以我可以在这里,那个机器主页等于一组条件。
So I could right over here, that machine home is equal to a set of conditions.

所以我们需要活塞,活塞在开始处。
So we need the pistons, the piston to be at the beginning.

让我们看看我们放置在这里的传感器。
So let's look at the sensors that we have placed this over here.

因此,我们需要的变量是活塞起始位置传感器,并且我们需要左侧位置的杠杆。
So the variable that we need is this piston start position sensor and we need the lever on the left position.

因此,拉动左侧位置传感器,它会在这里换一条新线。
So lever left position sensor and it's going a new line over here.

我们还需要电梯位于底部,钻头位于顶部,桌子位于此处。
And we also need that the elevator to be on the bottom and we need the drill to be in the top and we need the table to be here.

该表拾取位置传感器。
This one table pick up position sensor.

因此,如果我们以这种方式编写所有内容,我们就拥有了所需的一切。
So if we have everything written in this way, we shall have all we need.

那么为什么我们要做的就是看看机器上的变量是否真实,如果圣经通过了,我们就可以开始了。
So why do we need to do is see if the machine on the variable is true, if the Bible is through, we are good to go.

我们不需要任何其他东西。
We don't need anything else.

因此,假设如果拥有一台机器,那么让我们转移到一个新状态。
So let's say that if a machine is owned, then let's move to a new state.

假设 state 等于 20。
Let's say that state is equal to 20.

是说如果机器没有被拥有的话,我们看看我们需要做什么,所以我们在这里写一个声明。
Is that if the machine is not owned, let's see what we need to do, so let's write a statement over here.

看看我们需要做什么,所以让我们对其他所有事情执行即将到来的程序。
And see what we need to do, so let's carry out an upcoming procedure for everything else.

那么让我们看看这个人是否不在后面。
So let's look at this if the person is not at the back.

我们需要将活塞向后移动,所以没错,就在这里,如果我们没有这个活塞起始位置,那么如果没有活塞起始位置传感器,那么我们应该向后移动活塞,以便将活塞向后移动。
We need to move the piston backward, so that's right, this over here, if we do not have this piston start position, so if not pistons start position sensor, then we should move the piston backward in order to move the piston backward.

我们需要设置这个。
We need to set this.

让我们看看执行器。
Let's look at the actuators.

我们需要搬走你。
We need to move you.

请将此活塞的此变量设置为力。
Please set this variable of this piston forward to force.

那么让我们以这种方式尝试一下。
So let's try this in this way.

向前移动活塞。
Move piston forward.

Shabwah 等于武力。
Shabwah equal to force.

所以我们也在这里写一条评论,比如说活塞的爆炸。
So let's also write a comment over here, let's say bombing of the piston.

担。
Dan.

我们需要看看其他人。
We need to look at the others.

如果控制杆不在左侧位置,则我们现在应将此移动控制杆设置为强制。
If the lever is not on the left position, we have this move lever right now shall be set to force.

所以说是这样的。
So that's right.

如果没有,我们再看看那个传感器是永远不会留下位置的传感器。
If not, let's look at the sensor that is never left position sensor.

那么这不是操纵杆左侧位置传感器。
It's not the lever left position sensor then.

我们将设置这个变量来强制另一个变量。
We shall set to this variable to force this other one.

这会向前推进,对吗?
This moves forward, right?

所以如果拉杆不在左边位置,设置的拉杆向右强制移动,这就是拉杆归位。
So if the lever is not on the left position, the set move lever right to force, this is the homing of the lever.

让我们继续。
Let's move on.

我们需要看看电梯。
We need to look at the elevator.

但请记住,如果电梯正在以某种方式去杠杆化,我们就无法移动电梯。
But remember that if the elevator is if deleveraging is under way in a way, we cannot move the elevator.

所以在这里,假设我们以这种方式处理电梯,假设我们的控制杆位于左侧位置,而电梯没有位于下方位置。
So here, let's say that if the let's handle this in this way elevator, let's say that if we have the lever on the left position and we do not have the elevator on the down position on the lower position.

所以如果和不。
So if and not.

这是正确的。
That's right.

电梯按钮传感器,那么我们应该把电梯向下移动。
The elevator button sensor, then we should move the elevator down.

为了做到这一点,我们必须激活。
And in order to do so, we have to activations.

我们有向上移动的电梯和向下移动的电梯。
We have the move elevator up and the elevator down.

电梯上升应等于力向上,应等于下降,电梯向下移动应等于。
The elevator up should be equal to force up, should be equal to falls and the move elevator down should be equal to.

这样,如果我们拥有我们需要的杠杆,我们也可以做我们需要做的事情。
In this way, we if we have the lever in the way we need to also to do what we need to do.

如果该条件不再成立,如果该条件不再成立,则电梯应静止。
If this condition is no longer true, if this condition is no longer true, the elevator shall be still.

所以我们需要两个变量,向上移动或向下移动都为假。
So we need both variables, move it up and move it or down to be false.

这样,我们实际上正在处理电梯爆炸事件,所以让我们回顾一下证据是否妨碍或。
And this way, we are actually handling the bombing of the elevator, so let's recap if the evidence is in the way or.

是啊,电梯已经到了自己的位置,电梯不会动了。
Yeah, the elevator is already at its own position, the elevator will not move.

相反,如果我们已经交付了正确的位置,为什么电梯没有交付,我们实际上会让电梯正确移动。
If instead we have delivered on the correct position, why the elevator isn't, we will have actually the elevator to move correctly.

所以继续,我们需要处理。
So moving on, we need to handle the.

钻头的实际运动。
Actual movement of the drill.

那么对于演练来说,我们有类似的方式,所以没错。
So for the drill, we have a similar way, so that's right.

我们来这里演习,没有任何阻碍。
Coming for a drill here, we do not have anything in the way.

我们只需向上移动控制杆和钻头即可。
We simply need to move the lever, the drill up.

因此,如果没有上升,我们需要将其向上移动。
So if that is not up, we need to move it upward.

所以我们应该有一个钻顶传感器。
So we should have a drill top sensor.

你可以说,如果我们没有钻头传感器,那么我们需要向上移动钻头,这样我们的钻头就等于通过,然后向下移动钻头。
And you can say if we do not have the drill sensor, then we need to move the drill up so we have the drill up there shall be equal to through and then move drill down.

应等于 false,否则,因为钻取仍需要向上移动,则应为 false,并且向下移动钻取也应为 false。
There shall be equal to false or otherwise as they drill needs to be still moved up should be false and the moving drill down should be false as well.

这样,当我们到达顶部传感器时,我们就会静止不动。
In this way when we reach the top sensor that we will be still.

我们需要处理的最后一件事是加热桌子。
The last thing we need to handle for the warming is to the warming of the table.

我们只需一次驱动即可顺时针方向移动工作台。
We just have a single actuation to move the table on a clockwise in a clockwise way.

因此,移动桌子,移动如果通过以顺时针方向移动桌子。
So move table, move the if through moves the table in a clockwise way.

因此,如果我们没有正确的答案,我们需要移动桌子,直到得到正确的答案。
So if we do not have the correct answer, we need to move the table until we have it.

因此,如果我们没有将表向上位置传感器,则移动表表应等于 true,否则应等于下落。
So if we if not table up position sensor, then move table table shall be equal to true otherwise as it should be equal to falls.

这样,我们就需要处理机器中所有东西的轰炸。
And this way, we need to we handled the bombing of the of everything in the machine.

我们还需要处理剩下的指控,我们需要在机器未归位时不要停用夹具。
And we also needed to handle the remaining accusations that we have, we need the griper to not to be deactivated when the machine is not is homing.

所以这个级别的抓手在任何情况下都应该等于 false。
So this level of griper shall be equal to false in any case.

因此,在美国,我们可以说 Level Gripper 等于 false。
So over here in the States, we can say level griper equal to false.

我们也可以说是真实的。
We may also say that the real.

应该这样停止。
Should be stop this so.

真动应称为假动。
Real actuation shall be called the false.

用于将产品移至此处的空气驱动也应等于跌落,这也导致附近的产品出现错误,因为在该过程中,我们不希望任何物体碰到我们。
The air actuation that is used to move the products over here should be as well equal to falls, which has led to false also the products in the neighborhood, because during the procedure, we do not want any object to come our way.

另外,我们需要。
Also, we need.

表准备等于给力。
The table prepared to be equal to force.

纸等于磷。
Paper equal to Phos.

好的,这很好,我们应该拥有我们需要的一切,这样,如果我们一旦机器发出嗡嗡声,所有传感器都会通过机器发出回声,我们就会进入最终状态。
OK, so this this is good that we have we should have everything we need, and in this way, if we as soon as we have the machine hummed so all the sensors echo through the machine, we move to state finally.

如果我们没有所有这些传感器,首先,我们将执行我们在本声明中编写的 Omine 程序。
If we do not have all these sensors, first, we will carry out this Omine procedure that we wrote in this statement.

因此,一旦我们处于状态 20,我们就会追求总体而言,机器的周期,机器的完整周期。
So as soon as we are in state 20, we are going to go for the overall say, for the cycle of the machine, for the complete cycle of the machine.

因此,我们在状态 20 中,所有设备都处于正确的位置,我们可以从单个产品的循环结束开始。
So we have in this state, in the state 20, we have all the equipment in the correct position and we can start by coming out of the cycle for a single product.

所以我们要做的第一件事就是为我们的产品启用内场。
So the first thing that we need to do is to enable the infield for our products.

因此,假设 Feed 中的 20 个产品应该等于 2 个。
So let's say instead, 20 products in feed enable should become equal to two.

假设这个状态是我们等待产品的状态,所以我们启用产品价格的好处,我们需要等待,直到我们在这里为百斯顿提供产品。
And let's say that this state is the state where we wait for a product, so we enable the benefit of the price of the products, we need to wait until we have a product here for the Beston.

因此,Nasserite 如果活塞上的产品启动传感器。
So Nasserite if product on Piston starts Senser.

如果我们有一个产品,我们应该做一些不同的事情并转移到另一个状态。
If we have a product, we should that shall do something different and move to another state.

这是正确的。
That's right.

状态应等于 30。
State shall be equal to 30.

因此,让我们首先在这里保存并上网看看我们是否还可以写出一些状态抱歉,然后我们将上网看看机器是否按我们的预期工作。
So let's start by saving here and going online to see if let's also let's write out a few states sorry, and then we will go online and see if the machine works as we intended to.

所以在这种状态下,我们应该开始移动Hoopeston的活塞。
So in this in this state, we should start moving the piston Hoopeston.

我们来看看执行器。
So we have let's look at the actuators.

我们有.
We have the.

在这里将它们向前推动就等于推动和平,然后再向前,我们可以称之为真理,直到我们将产品放在永远可以被拿起的位置上。
Move them forward here shall be equal to to move peace, then forward, shall we call the truth until we get the product on the position for the ever to be picked up.

没错,如果我们用产品和传感器到达活塞的最终位置,该产品是否位于杠杆左侧传感器上?
So that's right, that if we reached the end position for the piston with the product and the sensor, is this product on lever left sensor?

这是一款用于皮革皮卡的产品。
It's a product for leather pickup.

这就是变量。
This is the variable.

那么我们应该搬到另一个州。
Then we should move to another state.

让我们看看状态等于 40,我们可以开始向后移动。
Let's see state equal to 40 and we can start moving back.

活塞推动活塞前进应该成为力量。
The Pistons move piston forward should become force.

让我们保存并上网看看是否一切正常。
Let's save and let's go online to see if everything is working.

让我们上网吧,永远是感官模拟模式。
Let's go online, always sensory simulation mode.

一旦我们上线观看,我将立即宣布可视化效果。
And I will announce the visualisations as soon as we are on line to see.

在这里看得更清楚。
See it better here.

因此,如果按机启动听到机器声音,则应始终在开始时回家。
So if a press start to hear the machine, this shall be always shall be home at the beginning.

因此,一开始,过了一会儿,他们看到附近的产品,过了一会儿,活塞开始移动,然后又返回。
So for a start, after a while, they see products in the neighborhood and after a while a piston starts moving and then it goes back.

正如我们所希望的那样。
As we intended it to be so.

正如您所看到的,我们位于 40 号州际公路上,并且什么也没有发生,因为我们没有编写任何内容,所以让我们继续编写我们的程序。
As and as you can see, we are Interstate 40 and that nothing is happening because we didn't write anything, so let's carry on writing our program.

如果我们开通 40 号州际公路,我们将需要它。
If we get Interstate 40, we shall need it to.

移动控制杆并开始修复夹具以抓取产品。
Move the lever and also start the repair the gripper in order to to grab the product.

因此,在状态 40 中,我们首先要激活夹具。
So here in state 40, we shall first of all, let's activate the gripper.

所以说是这样的。
So that's right.

水平夹具等于三。
Level gripper equal to three.

我们需要开始将情人移到右边。
And we need to start moving the lover to the right.

所以向右移动水平等于卡车。
So move level right equals the truck.

那么我们就这样做吧。
Then we shall do so.

这也是这里的评论。
That's also the comment over here.

假设启动水平夹具并移动皮革。
Let's say start level griper and move leather.

正确的。
Right.

所以我们要这样做,直到达到这个水平。
So we shall do so until we reach the level.

正确的。
Right.

该杠杆上方的传感器。
The sensor that is over that lever.

正确的。
Right.

位置传感器。
Position sensor.

当我们到达这个传感器时,我们应该停用夹具,这样我们就会看到将释放产品的杠杆,第一个杠杆和夹具等于 false。
When we reached this sensor, we should deactivate the gripper so we shall see that lever, which will release the product, the first lever and gripper equal to false.

让我们转到另一个州。
And let's move to another state.

假设这个状态是 50,那么。
Let's say that this state is 50, so.

至此,我们已经完全在右侧交付了,为了让电梯向上移动,我们可以再次将操纵杆向后移动。
At this point, we have delivered completely on the right and that in order to allow the elevator to move up, we can move lever back again.

因此,在状态 50 中,我们将向左移动控制杆。
So in the state 50, we shall move the lever left.

所以我们到了这里,我们需要出发,永远不要离开瀑布。
So we're here, we need to set to move, never left the falls.

所以抱歉,向右移动到强制,这是执行器的名称,我们将等到情人离开传感器等于然后我们将移动到另一个状态。
So sorry, move right to force, and this is the name of the actuator, and we shall wait until the lover left Senser is equal to then we shall move to another state.

所以就在这里,state 应该等于 60。
So that's right over here, state should become equal to 60.

好的,此时,我们应该将产品放在电梯上并从左侧运送回来。
OK, so at this point, we should have the product on the elevator and deliver back on the left.

让我们试试这个。
Let's try this.

那么让我们再次上网下载吧。
So let's go online with the download again.

看看会发生什么。
And see what happens.

我们先从程序开始吧。
Let's start with the program.

我将把可视化再打开一点,让我们看看。
I will open the visualization a bit more to allow us to see.

那么让我们按下开始按钮。
So let's press the start button.

出现一个产品。
A product appears.

当活塞队移动、后退时,我们的爱人抓住了它。
Our lover grabs it while the Pistons move, moves back.

我们可以看到,比如说,看到或听到该产品被正确地放置到这里的电梯上,我们将有另一个产品。
And we can see, say, see or hear that the product is correctly placed onto the elevator over here, we will have another product.

目前,我们不会管理它。
For now, we will not manage it.

我们将在接下来的两个视频中了解如何执行此操作。
We will see how to do this in the next two videos.

我们将专注于,呃,一次处理一种产品。
We will focus on, uh, on on handling one product at a time.

那么让我们回到离线状态。
So let's go back offline.

我们去 60 号州际公路,我们需要将电梯移至 60 号州际公路。
And let's go Interstate 60, where we need to move the elevator up to 60.

瞧,丽莎,来吧,来吧,把电梯移上去。
See, Lisa, come, come, move the elevator up.

稍等片刻,我们首先应该这样做。
In just a moment here, we should, first of all.

启用将电梯向上移动的驱动,因此我们向上移动电梯的次数应等于 2。
Enable the actuation to move the elevator up, so we have move elevator up there should become equal to two.

与电梯向下移动的力应相等。
And move the elevator down should be equal to force.

应该执行此操作,直到电梯顶部传感器等于将其扔到电梯传感器等于 true,我们已到达产品的最终位置,并且我们已将其正确放置在钻孔站的地板上。
This should be done until the elevator top sensor is equal to throw it to the elevator sensors equal to true, we have reached the final position over here for the product and we have correctly placed it onto the floor on the drilling station.

所以电梯实际上应该能够向下移动。
So the elevator should be actually able to move down.

因此,让我们纠正这个声明的反面。
So let's right the opposite of this declaration.

因此,苹果应该加快移动电梯的速度,而向下移动电梯应该可以通过。
So move elevator that Apple should become fast and move elevator down should be through.

好的,这太棒了。
OK, this is great.

所以。
So.

在这里,让我们看看。
Here, let's see.

如果工作正常的话。
If it works correctly.

开始吧。
Let's start.

产品被拖到这里,被抓住。
Product is dragged here, grabbed.

一旦恋人回来,电梯就启动了。
That ever goes back as soon as the lovers back, the elevator starts.

这里,有一些问题。
Here, there is something wrong.

当然,我没有写新的状态语句,所以状态应该等于70。
Of course, I didn't write the new state statement, so state shall be should become equal to 70.

我们上网吧。
Let's go online.

我们也进行在线更改。
Let's also carry out an online change.

有什么重要的?
What matters?

正如你所看到的,信现在又回来了。
And as you can see, the letters back now.

好的。
OK.

所以在这里我们可以简单地将其留在这里,但为了能够处理下一个产品,我们应确保电梯已正确到达最终的下降位置。
So here we can we could simply leave this here, but in order to be able to process the next product, we shall be make sure that the elevator is has correctly reached the final the down position.

那么让我们转到状态 70。
So let's move to the state 70 here.

让我们看看这里将电梯向下移动,因为只是为了与其他状态保持一致,我们可以剪切这些分配的状态并将它们放在这里。
Let's see here move elevator down, because simply in order to be coherent with the other states, we can cut the state these assignments and place them over here.

所以我们在这里把电梯向下移动。
So here we are moving the elevator down.

同样,我们应该等待电梯。
And in the same way, we should wait for the elevator.

那个按钮,我猜,呃,电梯按钮传感器。
That button, I guess, uh, elevator button sensor.

如果我们得到电梯按钮传感器,我们应该将电梯所有内容向上写入等于力并将电梯向下移动到电话以便正确停止它,然后移动到另一个等于 80 的状态,OK。
And if we get the elevator button sensor, we should write elevator everything up equal to force and move elevator down to phones in order to properly stop it, OK, and move to another state state equal to 80, OK.

所以现在,产品应该位于钻孔站的顶部。
So right now, the product should be here on the top on the drilling station.

所以我们需要做的是。
So what we need to do is.

移动,开始向下移动。
Move, start moving that way down.

所以我们可以听到我说,移动,向下钻取,当它向下移动时,我们被激活并激活钻取。
So we can hear I say, move, drill down, and while it is moving down, we are activated and activated drill.

因此,我们应该将钻探激活写为等于 2,并且以与电梯相同的方式,我们将其向下移动。
So we should write drill activation equal to two and in the same way as the elevator, we shall move it down so.

好吧,深入研究。
Well, drill down.

因此,向上应该等于下降,而向下钻取应该等于 true。
So up should be equal to falls and drill down should be equal to true.

我们应该这样做,直到钻底传感器变为真实。
And we should be doing this until the drill bottom sensor becomes true.

当钻底传感器变为真时,我们应该停止钻机。
When the drill bottom sensor becomes true, we should stop the drill.

因此,将此行复制并粘贴到此处,将它们都设置为 false。
So this copy and paste this line over here, setting both of them equal to false.

让我们转到另一个州。
And let's move to another state.

好的,为了正确地钻探和平对象,我们实际上需要等待一点时间钻探。
OK, so in order to properly drill the the peace, the object, we need to actually wait a little time drilling.

而对于实际的,呃,对于模拟程序的类型,我们要演练两秒钟。
And for the actual, uh, for the type of program of simulation, we shall drill for two seconds.

因此,为了做到这一点,我们需要这样做。
So in order to do this, we need to.

正确的。
Right.

放置一个计时器。
To place a timer.

所以,我们可以说,这对 Yoanna 来说很棒,如果你还记得的话,这是一个计时器。
So let's say that that's great at Yoanna, if you remember, this is a timer on.

因此,让我们创建一个吨吨钻孔,即 T1,我们将在有限状态机之外调用计时器,这样我们就可以转到这里,按 F2,让我们搜索 T1 钻孔。
So let's create a ton ton drilling that is a T1 and we shall place a call for the timer and outside of the of the finite state machine so we can go over here, press F2 and let's search for the T1 drilling.

当时就在泥炭地里。
And that's right over here in the peaty at time.

让我们看看,两秒钟。
Let's see, two seconds.

所以在该州,90。
So in the state, 90.

我们实际上应该管理栏杆,等待,所以等待真正的。
We should actually manage the railing, waiting, so wait for real.

所以我们应该开始聆听。
So we should start hearing.

所以,这是正确的,计时你的钻探时间,如果你记得舌头是如何工作的,你就可以在泥炭时间库比通过后设置不平等。
So that's right, time your drilling that in equal to true, if you remember how the tongue works, you set the inequal through after the peaty time Kubi comes through.

因此,我们等待,如果在 Q Ziko 钻探过程中,我们首先向 Rossett 计时器展示了化石,我们应该停止钻头驱动。
So we wait if during drilling that Q Ziko through then we showed first of all Rossett timer the fossil we should stop the drill actuation.

因此,钻头驱动也应该等于跌倒,我们应该转移到另一个状态。
So drill actuation should become equal to falls as well and we should move to another state.

State 应该变成等于数百。
State should become equal to hundreds.

抱歉,这里我没有写状态,没有。
I'm sorry, here, I didn't write the state, no.

好的,在状态 100 中,我们刚刚对产品进行了钻取,我们需要再次向上移动钻取。
OK, in the state 100, we have just drilled the product and we need to move the drill up again.

所以我们将深入了解状态 100。
So we'll drill up state 100.

我们会做对的。
We will right.

向上移动钻头等于部队移动,向下钻头等于下降,我们将向上移动钻头,直到到达上方位置。
Move drill up equal to troop move, drill down equal to falls and we shall move the drill upwards until we get to the upper position.

因此,直到我们到达钻头顶部传感器,然后当我们到达钻头传感器时。
So until we reach the drill top sensor then when we get to the drill that sensor.

我们将停止烤架的移动,一些向上的油应该变成假的,向下移动的钻头也应该变成假的。
We will stop the movement of the grill, some of the oil up should become false and move drill down should become false as well.

让我们转到等于 110 的状态。
And let's move to state equal to one hundred and ten.

所以我们的产品在这里正在被正确地、正确地钻孔。
So our product is here is being correctly, correctly drilled.

而我们只是需要。
And we just need.

为了通过此激活向前移动,因此我们所说的状态 110 通过空气激活向前移动产品,为了做到这一点,我们只需将空气激活​​写入等于 true。
To move it forward with this activation, so and the state 110 that we say move product forward with air activation, and in order to do that, we simply need to write air activation equal to true.

如果产品到达这个位置。
And if the product arrives in this position.

我们需要停止激活,所以传感器的名字是。
We need to stop the activation, so the name of the sensor is.

表格条目上的产品。
Product on table entry.

因此,如果产品在表条目上,那么 er 驱动应该变为 false,并且我们需要移动到另一个状态 state。
So if product on table entry, then er actuation should become false and we need to move to another state state.

一百二十。
One hundred and twenty.

好的。
OK.

所以我们应该准备好,我们的产品应该被钻孔并应该到达这个位置。
So we should be good to go and our product should be drilled and should reach this position.

因此,让我们重新开始下载,看看它是否有效。
So let's start again with the download and see if it works.

让我们开始程序吧。
Let's start the program.

让我们开始吧。
And let's start.

我们知道第一部分应该像我们已经做的那样工作。
We know that this first part should be working as we already did it.

电梯上升。
The elevator goes up.

水下降,然后钻头应该开始,好吧,下降,下雨,然后水上升。
The water goes down and then the drill should start, OK, goes down, it rains and it goes up after that.

今天,启动开始。
Today, actuation starts.

直到产品到达表项。
Until the product reaches the table entry.

好的,这太棒了。
OK, so this is great.

请记住,这里有我们的颜色传感器。
Remember, over here we have our color sensor.

因此,在传感器中,您会看到这个颜色传感器,称为检测到拾取位置下降意味着产品是红色的,通过意味着产品是蓝色的。
So here in the sensors, you see this color sensor that is called detected that the pickup position falls means that the product is red and through means that the product is blue.

所以问题是,当我们到达状态一百二十时,我们实际上应该保存有关状态的信息。
So the problem as we reach state one hundred and twenty, we should actually save the information regarding the state.

我们应该在 if 语句上执行此操作,以确保产品存在。
And we should do this right here onto this if statement where we are sure that the product is there.

所以我们将在这里创建一个我们看到的变量。
So we will right here will create a variable that we see.

我们称之为,呃,产品颜色是可变的。
We call it, uh, product color that is and variable.

并且该产品的颜色应与颜色传感器相同。
And this product color should be equal to the color sensor.

我们保存这些信息是因为我们想在稍后移动到桌子上时使用它。
We are saving this information because we want to use it later when we are moving onto the table.

因此,当我们达到这种状态时,我们将移动桌子。
So as we reach this state, we shall move the table.

所以我们把状态组称为,嗯,产品抓取器和移动台,所以这里我们需要首先抓取产品。
So let's call the state group, um, griper for product and move table, so here we need to first grab the product.

我们需要摆桌子。
We need to set the table.

夹具等于 true。
Griper equal to true.

他们抱怨,你可以展示并开始移动桌子,所以在这里也移动与特朗普相同的桌子。
They griper, you could show and start moving the table, so move table equal to Trump as well here.

我们需要继续前进。
We need to keep moving.

一阵子。
For a while.

那么我们什么时候需要停下来呢?
So when do we need to stop?

我们需要根据我们在这里检测到的颜色来选择星星的位置。
We need to select our star position according to the color that we detected over here.

所以我们需要停下来。
So we need to stop.

在红十字位置,如果我们检测到红色或蓝色。
At the Red Cross position, if we detected a red color or a blue.

反对派,如果您检测到蓝色,那么我们可以写下,如果我们没有颜色,这意味着抱歉,这不是产品颜色。
The opposition, if you detected blue so we can write that if we have not color, meaning that the not product color sorry.

这意味着我们检测到了红色产品,并且表格读取了跌落位置传感器。
This means that we detected the red product and the table read the drop position sensor.

这意味着我们到了。
This means that we arrived.

或者,如果我们检测到副产品颜色的蓝色产品等于真实颜色,并且我们在桌子上,蓝色滴位置,这意味着我们在,您可以写信给我们。
Or you can write to we if instead we detected that blue products of co-product color equals the true and we are at the table, the blue drop position, this means that we are.

好的。
All right.

所以。
So.

如果我们是红色的并且我们到达了红色命题,那么我们就到达了,或者相反,我们是蓝色的并且我们到达了蓝色,
If we are red and we get to the red proposition, we are arrived or instead of we are blue and we get to the blue, the.

这也意味着我们可以在这两种情况中的任何一种情况下顺风顺水。
This means as well that we have a ride in either one of these case.

我们需要停止表,停止表并移动到 30 所在的另一个状态。
We need to stop the table, stop the table and move to another state where the 30.

好的,这很好。
OK, this is good.

我们也在这里,为了进行模拟,我们需要一些时间来实际投放产品。
We also over here, for the sake of the simulation, we need some time to actually drop a product.

所以。
So.

这里笑一下,这是等待产品在状态一百三十下落下,我们需要编写等于 Falls 的表夹具才能开始落下产品。
Laugh right over here that this is wait for product to drop in state hundred and thirty, we need to write table gripper equal to falls in order to start dropping the product.

我们需要开始一个新的Tionne。
And we need to start a new Tionne.

那么让我们创建另一个东西。
So let's create another thing.

我们就给这个小镇起个名字吧。
Let's call this town.

嗯,我们可以使用另一个 Tionne 来删除产品,或者我们可以简单地使用我们使用的第一个。
Um, we can use another Tionne to drop a product or we can simply use the first one that we used.

让我们改变它的名字。
Let's change its name.

假设这是一个计时器,而不是说这是一个通用计时器。
Let's say that this was let's call this a timer instead of let's say that this was a generic timer.

让我们也改变它,这样我就可以改变名字并留在九十在这里,改变这里的名字。
Let's change it as well so I can change the name and stay ninety over here, changing the name over here.

我可以删除这个简洁的输入,以便能够将相同的计时器用于不同的目的。
And I can remove this pithy input in order to be able to use the same timer for different purposes.

所以在这里,我可以说,当我烧烤时,我可以写下通用时间,这几乎等于选择询问、选择的秒数。
So over here, I can say that when I'm grilling, I can write the generic time that pretty equal to choose seconds to ask, to choose.

为了放下产品,我们只需要半秒钟。
And in order to drop the product, we need only half a second.

那你还好吗?
So you're OK?

我可以写。
I can write.

抱歉,在这里,我错过了一个传感器,我可以写一个通用计时器,它应该等于四秒。
I'm sorry, here, I missed a sensor here, I can write that a generic timer that pretty should be equal to four seconds.

这样我就可以使用同一个计时器来实现这两个目的。
In this way I can use the same timer for both purposes.

所以在这里我写了一个通用计时器,它与之前一样,如果我得到一个通用计时器,那么这些提示分钟意味着设置的计时器已经过期。
So here I write the generic timer that in equal the true and as before, if I get a generic timer, those cue minutes meaning set the timer has expired.

我们进入了一个新的状态。
We get to a new state.

我们需要把桌子移回来。
We need to move back the table.

到第一个位置,到起始位置,所以状态应该等于一百四十年,比方说,移动产品移动抱歉,桌子拿起位置。
To the first position, to the start position, so states should become equal to one hundred and forty years, let's say move product to move sorry, table to pick up position.

嗯,40。
Well, 40.

在该语句中,该表应该变为等于 true。
In the statement, the table should become equal to true.

我们应该继续移动桌子,直到我们到达桌子,拿起位置,拿起位置,然后是 SACEUR。
And we should keep moving the table until we reach the table, pick up the position, pick up positions, SACEUR then.

当我们到达这个位置时,移动表应该变为 false,并且状态实际上应该是我们完成了我们的产品,并且我们可以返回到机器处于活动状态的第一个状态。
When we reached this position, move table should become false and the state should be actually we finished with our product and we can move back to the first state where the machine was active.

那是国营的。
That is state run.

没错,20。
So that's right, 20.

让我们上网看看这是否有效。
Let's go online and see if this works.

好的。
OK.

这就是为什么有时您需要关闭可视化并重新打开它的原因。
So that's why sometimes you need to close the visualisations and reopen it.

他们就在这里,这是一个开始,看看一切是否按照我们的预期进行。
They have it right here, that's a start and see if everything works as we intended it to.

带有蓝色产品。
With a blue product.

当我们有了红色产品后,这很棒,所以我们会看看它们是否是由不同职位的人起草的。
And after we have a red product, this is great, so we will see if they are being drafted by the people in different positions.

所以钻孔工作正在进行中。
So the drilling is working.

空气。
The air.

正在推产品。
Is pushing the product.

这是正确的等级。
It is correctly grade.

然后将其掉落到蓝色掉落位置。
And it is dropped onto the blue drop position.

好的,所以一切都很顺利。
OK, so everything went well for that.

下一个产品正在加工中。
And the next product is being processed.

有什么不对劲的地方。
Something there is wrong.

我们看到该产品尚未发布,因此代码中存在一些问题,并且删除不正确。
We have seen the product has not been released, so there are some issues in the in the code and also the dropping is not correct.

那么让我们回到正题。
So let's get back into it.

那么让我们看看为什么这里的产品会出现问题。
So let's see why the product as in here is the problem.

我没有设置定时器。
I didn't set the timer.

所以在通用时间时,那个立方体也应该设置同等下的通用时间。
So when generic time, that cube also should set generic time that in equal falls.

好的。
OK.

而十足的产品感又与什么有关呢?
And full what concerns the product sense?

让我们回到线上吧。
Let's go back online.

看看吧。
And see.

会发生什么?
What happens?

我们的产品调用者是。
Our product caller is.

对不起等于。
Sorry is equal to.

错误的。
False.

好吧,那里的情况很糟糕。
OK, it has been rough there.

我们还有另一个。
We are having another.

正确的产品。
Right product.

让我们看看,颜色传感器应该保持正常。
Let's see, color sensor should remain OK.

现在这正在发挥作用。
Now that is working.

所以我们解决了这个问题。
So we fixed that.

冰色似乎依然存在。
The color ice seems to remain.

以及产品掉落在红色命题上,所以。
Falls as well as the product is dropped on the red proposition, so.

那很可爱,我愿意。
That's cute, I would.

跳过视频的这一部分,直到我们看到蓝色产品,好的,这里我们有一个正在加工的蓝色产品。
Skip this part of the video until we get to the blue product, OK, here we have a blue product being processed.

好吧,癌症的起因是我跌倒了,所以。
OK, cause cancer is has been ismy falls, so.

因此,我们需要设置一个小的延迟,以便能够正确读取颜色传感器,因为这是一个模拟,可以说是模拟的一部分,我们只有在项目完成后才能更快地读取传感器写这个。
So we need to place a small delay in order to be able to correctly read the color sensor, because this is a simulation, let's say simulation part of it, that we are reading the sensor only to faster just as soon as the project as I write this.

所以我们需要进入这里的中间海况。
So we need to move to an intermediate sea state over here.

让我们转到状态 150 以及我们放置的通用计时器。
Let's move to state 150 and the as well our generic timer that we placed.

没错,你还不到50岁。
So that's right, you're under 50.

让我们延迟读取颜色传感器。
And let's have a delay to read the color sensor.

因此,我们还需要使用通用计时器来代替 150。
So instead 150, we need to use our generic timer as well.

因此,只应控制拉丁语的时间和 BP 的时间,比如说半秒。
So only time a Latin should be controlled and the time that BP let's have, let's say, half a second.

如果我们的通用时间像灵感一样,那么我们需要重置计时器,这样旧的计时器应该等于物理力。
If our generic time as as inspired, then we need to reset the timer, such an old timer that the physical should be equal to force.

这里我们需要读取颜色传感器。
And here we need to read the color sensor.

是的,什么颜色应该等于颜色?
Yes, what color should become equal to color?

传感器和状态应等于 120。
Sensor and state should become equal to 120.

那么让我们回到线上并进行在线更改并查看。
So let's go back online and let's go with an online change and see.

如果产品掉落在正确的位置。
If the products are being dropped on the correct position.

是的,不幸的是,我们有很多很棒的产品,我总是为你跳过这个。
Yes, unfortunately, we are having lots of great products, I always skip this for you.

好的,我们这里有一个蓝色的产品。
OK, so here we have a blue product.

让我们看看它被抓住了。
Let's see it being grabbed.

并且它被落在正确的位置。
And it is dropped on the correct position.

好的。
OK.

因此,我们设法为机器构建了一个完整的循环,在下一个视频中,我们将管理此停止紧急情况和所有按钮,以便为机器执行此类实施。
So we managed to build a complete cycle for the machine, and in the next video, we will manage this stop emergency and all the buttons in order to carry out for this type of implementation for the machine.

正如您所看到的,这并不是最佳的。
As you can see, this is not optimal.

这不是我们想要去的原因,因为,正如你所看到的,许多类型的任务可以并行完成。
And this is not why we want to go, because, as you can see, many types of tasks can be done in parallel.

这里的这个产品可以被推到杠杆上。
This product over here could be pushed onto the lever.

在下一组视频中,我们还将了解如何执行此操作。
And in the next set of videos, we will also see how to do this.

正确的。
Right.

该视频旨在刷新融资机器以及我们稍后将在该机器的下一次实施中使用的知识。
And this video is meant to be for it to be a refresh to for financing machines and for knowledge that we will use later in the next implementation for this machine.